<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', [\App\Http\Controllers\HomeController::class,'index']);
Route::get('/generateAvatar', [\App\Http\Controllers\HomeController::class,'generateAvatar']);
Route::get('/categorySearch', [\App\Http\Controllers\HomeController::class,'categorySearch']);
Route::get('/book/{book}', [\App\Http\Controllers\HomeController::class,'book']);
Route::get('/ad/{announcement}', [\App\Http\Controllers\HomeController::class,'ad']);


Route::get('/login',[\App\Http\Controllers\AuthController::class,'login'])->name('login');
Route::get('/register',[\App\Http\Controllers\AuthController::class,'register']);
Route::post('/loginLogic',[\App\Http\Controllers\AuthController::class,'loginLogic']);
Route::post('/registerLogic',[\App\Http\Controllers\AuthController::class,'registerLogic']);
Route::get('/logout',[\App\Http\Controllers\AuthController::class,'logout']);



Route::group(['middleware' => 'auth'], function () {
    Route::get('/userCenter', [\App\Http\Controllers\UserController::class,'index']);
    Route::post('/postBookComment', [\App\Http\Controllers\HomeController::class,'postBookComment']);
    Route::post('/postChat', [\App\Http\Controllers\HomeController::class,'postChat']);
    Route::get('/chat', [\App\Http\Controllers\HomeController::class,'chat']);
    Route::post('/audit', [\App\Http\Controllers\HomeController::class,'audit']);
    Route::post('/returnBook', [\App\Http\Controllers\HomeController::class,'returnBook']);

    Route::get('/book/{book}/borrow', [\App\Http\Controllers\HomeController::class,'borrow']);
    Route::post('/user/updateInfo', [\App\Http\Controllers\UserController::class,'updateInfo']);
});
